package com.linyx.simpleboot.service.impl;

import com.linyx.simpleboot.domain.Account;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.linyx.simpleboot.mapper.AccountMapper;
import com.linyx.simpleboot.service.AccountService;

@Service
public class AccountServiceImpl implements AccountService{

    @Autowired
    AccountMapper accountMapper;

    @Transactional
    public void update() throws RuntimeException{
        accountMapper.updateAccount(90,1);//用户1减10块 用户2加10块
//        int i=1/0;

        Account account =accountMapper.select(1);
        System.out.println(account.toString());
        accountMapper.updateAccount(110,2);
    }
}